package com.androgl.math;

public class Vector3D {

	public float x,y,z;
	
	public Vector3D() {
		x = y = z = 0.0f;
	}
	
	public Vector3D(float newX,float newY,float newZ) {
		x = newX;
		y = newY;
		z = newZ;
	}
	
	public void add(Vector3D v) {
		x += v.x;
		y += v.y;
		z += v.z;
	}
	
	public void mul(float fValue) {
		x *= fValue;
		y *= fValue;
		z *= fValue;
	}
	
	public float dot(Vector3D v) {
		return ((x * v.x) + (y * v.y) + (z * v.z));
	}
	
	public Vector3D cross(Vector3D v) {
		return new Vector3D((y*v.z-z*v.y),(z*v.x-x*v.z),(x*v.y-y*v.x));
	}
	
	//[TODO] Why cant void cross(X) and Vector3D cross(x) ?
	public void _cross(Vector3D v) {
		x = (y*v.z-z*v.y);
		y = (z*v.x-x*v.z);
		z = (x*v.y-y*v.x);
	}
}
